# 子类调用父类的属性和方法: super().父类方法名(), 更加灵活
# 使⽤super() 可以⾃动查找⽗类，适合单继承使⽤，多继承不建议使用


# 1 定义HeimaSchool类 /kongfu /make_cake
class HeimaSchool(object):
    def __init__(self):
        self.kongfu = '[黑马配方]'
        pass

    def make_cake(self):
        print(f'使用{self.kongfu}摊煎饼')
        pass


# 2 定义徒弟类 单继承继承 HeimaSchool
class Prentice(HeimaSchool):
    def __init__(self):
        self.kongfu = '[独创摊煎饼技术]'
        pass

    def make_cake(self):
        print(f'使用{self.kongfu}摊煎饼')
        pass


    # 通过super().方法名()来调用父类的方法
    def make_school_cake(self):
        # HeimaSchool.__init__(self)    # 父类名修饰 有冗余
        # HeimaSchool.make_cake(self)   # 父类名修饰 有冗余
        super().__init__()
        super().make_cake()
        # super(Prentice, self).make_cake()


# 3 实例化徒弟类, 调用属性/调用方法
xiaoming = Prentice()  # 注: 实例化类对象,不要忘()
print(xiaoming.kongfu)
xiaoming.make_cake()

xiaoming.make_school_cake()




